<?php
namespace catchAdmin\customs\model\search;

trait OrderSonSearch
{
    /*
     *  订单编号
     */
  public function searchorderIdAttr($query, $value, $data)
  {
    return $query->whereLike('a.orderId', $value);
  }
  /*
   * 订购人证件号
   */
  public function searchConsigneeCodeAttr($query, $value, $data)
  {
    return $query->whereLike('b.ConsigneeCode', $value);
  }
  /*
   * 收货联系人
   */
  public function searchcontactNameAttr($query, $value, $data)
  {
    return $query->whereLike('b.contactName', $value);
  }
  /*
  * 海关订单推送
  */
  public function searchpushOrderAttr($query, $value, $data)
  {
    return $query->where('b.push_order', $value);
  }
  /**
   * 运单接口状态
   */
  public function searchpushInventoryAttr($query, $value, $data)
  {
    return $query->where('b.push_inventory', $value);
  }
  /**
   * 订单日期
   */
  public function searchorderDateAttr($query, $value, $data)
  {
      if(!empty($value)){
        return $query->whereTime('b.orderDate', 'between', [$value[0], $value[1]]);
      }
  }
  /**
   * 订购人姓名
   */
    public function searchbuyerNameAttr($query, $value, $data)
    {
        return $query->whereLike('b.buyerName', $value);
    }

  /**
   * 运单接口状态
   */
    public function searchwaybillStatusAttr($query, $value)
    {
        return $query->whereLike('b.waybill_status', $value);
    }
    /**
   * 商户名
   */
    public function searchmerchantNameAttr($query, $value, $data)
    {
        return $query->whereLike('c.merchant_name', $value);
    }
    /**
     * ids
     */
    public function searchidsAttr($query, $value, $data)
    {
        return $query->where('a.orderId','in',$value);
    }

  // public function searchStatusAttr($query, $value, $data)
  // {
  //   return $query->where('status', $value);
  // }
}